﻿/// <reference path="../Core.ts" />

module Supernova {

    export class FpsCounter {

        public fps: number = 0;

        private start: number = 0;

        private frameCount: number = 0;

        endFrame() {
            this.frameCount++;
            if (this.frameCount == 10) {
                var now = new Date().getTime();
                var averageTimePerFrame = (now - this.start) / 10;
                this.fps = Math.floor(1000 / averageTimePerFrame);
                this.start = now;
                this.frameCount = 0;                
            }
        }

    }

}